﻿<!DOCTYPE HTML>
<html>
<head>
<#include "head.html">
<title>日志表</title>
</head>
<!-- 资源列表 -->
<body>
<nav class="breadcrumb" style="padding: 0px 15px;margin-bottom: 0px; "><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>
    <#if pmenu.menuName!>
        ${(pmenu.menuName)!}
        <span class="c-gray en">&gt;</span>
    </#if>
    ${(menu.menuName)!}
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<div class="text-c">
		<input type="text" class="input-text" style="width:250px" placeholder="输入名称" id="name" name="">
		<button type="button" class="btn btn-success" id="" onclick="App.seach()" name=""><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
	</div>
	<div class="mt-20">
		<span class="l">
			<@shiro.hasPermission name="EditSysLog">
			<a href="javascript:;" onclick="App.add()" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加</a>
			</@shiro.hasPermission>
		</span>
	</div>
	<table id="table">
		<thead>
	        <tr>
	        	<th></th>
                <!--<th>用户id</th>-->
                <th>用户</th>
				<th>日志标题</th>
               <!-- <th>用户类型  0 超管 1普通管理员</th>-->
                <th>地址</th>
                <th>请求方法</th>
               <!-- <th>方法</th>-->
                <th>ip</th>
                <!--<th>host</th>-->
                <th>参数</th>
                <!--<th>客户端信息</th>
                <th>日志时间</th>-->
				<th>操作</th>
	        </tr>
	    </thead>
	</table>
</div>
</body>
<#include "footer.html">
<script type="text/javascript">
$(function(){
    var bs_table=BootstrapTable.init({
        url:"${contextPath}/sysLog/list.do",
        data:{
        },
        columns:[
            {checkbox: true},
            /*{field: 'userId'},*/
            {field: 'userName',width:80},
            {field: 'title',width:120},
            /*{field: 'userType'},*/
            {field: 'url',width:180},
            {field: 'method',width:80},
            /*{field: 'classMethod'},*/
            {field: 'ip',width:120},
            /*{field: 'host',width:120},*/
            {field: 'params'},
            /*{field: 'clientInfo'},*/
            /*{field: 'createTime',width:80},*/
            {align: 'center',
                formatter: function (value, row, index) {
                    var html='';
                <@shiro.hasPermission name="UpdateSysLog">
                    if(row.state==1){
                        html+='<a style="text-decoration:none" onClick="App.stop(this,'+row.id+')" href="javascript:;" title="禁用"><i class="Hui-iconfont">&#xe631;</i></a>';
                    }else{
                        html+='<a onClick="App.start(this,'+row.id+')" href="javascript:;" title="启用" style="text-decoration:none"><i class="Hui-iconfont">&#xe615;</i></a>';
                    }
                </@shiro.hasPermission>
                <@shiro.hasPermission name="EditSysLog">
					html+='<a title="编辑" href="javascript:;" onclick="App.edit(this,'+row.id+')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a>';
                </@shiro.hasPermission>
                <@shiro.hasPermission name="DelSysLog">
                    html+='<a title="删除" href="javascript:;" onclick="App.del(this,'+row.id+')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>';
                </@shiro.hasPermission>
					return html;
                }
            }

        ]
    })

App={
	seach: function (){
        var data={
            name:$("#name").val(),
        }
		bs_table.seach(data);
	},
	/*增加*/
	add:function (){
	    AppList.add("${contextPath}/sysLog/goEdit.do")
	},
	/*编辑*/
	edit:function (obj,id){
        AppList.edit("${contextPath}/sysLog/goEdit.do?id="+id)
	},
	/*删除*/
	del:function (obj,id){
	    var config={
	        url:'${contextPath}/sysLog/del.do',
            data:{
                id:id,
            },
			table:bs_table,
		}
        AppList.del(config)
	},
	/*停用*/
	stop:function (obj,id){
        var config={
            url:'${contextPath}/sysLog/update.do',
            data:{
                id:id,
                state:2
            },
            table:bs_table,
        }
        AppList.stop(config)
	},
	/*启用*/
	start:function (obj,id){
        var config={
            url:'${contextPath}/sysLog/update.do',
            data:{
                id:id,
                state:1
            },
            table:bs_table,
        }
        AppList.start(config)
	}
}
});
</script>
</html>